package avicit.bdp.oss.utils.common;

/**
 * @金航数码科技有限责任公司
 * @作者：developer
 * @邮箱：developer@avic-digital.com
 * @创建时间： 2020-11-12
 * @类说明：Constant
 * @修改记录：
 * @注意事项：
 */
public class Constants {
    /**
     * 分页查询桶时，排序标准;1:按修改时间倒序、2:按修改时间升序、3:按桶/对象名称升序、4:按桶/对象名称倒序
     */
    public static final int ORDERED_BY_MODIFIED_TIME_DESC = 1;
    public static final int ORDERED_BY_MODIFIED_TIME_ASC = 2;
    public static final int ORDERED_BY_BUCKET_NAME_ASC = 3;
    public static final int ORDERED_BY_BUCKET_NAME_DESC = 4;
    public static final int ORDERED_BY_OBJECT_NAME_ASC = 3;
    public static final int ORDERED_BY_OBJECT_NAME_DESC = 4;

    public static final String ORDERED_BY_LAST_UPDATE_TIME = "last_update_date";
    public static final String ORDERED_BY_BUCKET_NAME = "bucket_name";
    public static final String ORDERED_BY_OBJECT_NAME = "object_name";
    public static final String ORDERED_ASC = "asc";
    public static final String ORDERED_DESC = "desc";

    /**
     * 英文逗号
     */
    public static final String COMMA = ",";

    /**
     * 下载文件时Buffer大小
     */
    public static final int FILE_WRITER_BUFFER_SIZE = 1024;

    /**
     * 统计信息使用，用于容量转换
     */
    // 容量字节数
    public static final long KB = 1024L;
    public static final long MB = 1048576L;
    public static final long GB = 1073741824L;
    public static final long TB = 1099511627776L;
    // 容量单位
    public static final String BYTE_UNIT = "B";
    public static final String KB_UNIT = "KB";
    public static final String MB_UNIT = "MB";
    public static final String GB_UNIT = "GB";
    public static final String TB_UNIT = "TB";
    // 保留两位小数
    public static final String DATA_FORMAT = "0.00";
    // 保留为百分比
    public static final String PERCENT_FORMAT = "0.00%";
    // 对象单位，个
    public static final String NUM_UNIT = "次";
    // 最近七天
    public static final int RECENT_DAYS = 7;
    // 最近12小时
    public static final int RECENT_HOURS = 12;
    // 时区
    public static final String TIME_ZONE = "GMT+8:00";
    // 一条对应的毫秒数
    public static final int DAY_MILLS = 86400000;
    // 分页查询时每页大小
    public static final int MAX_PAGE_SIZE = 1000;
    // 12小时对应毫秒数
    public static final int TWENTY_HOURS_MILLS = 43200000;
    // 1小时对应毫秒数
    public static final int ONE_HOUR_MILLS = 3600000;
    // 坐标相关常量
    public static final int NUM_TWO = 2;
    public static final int NUM_FOUR = 4;
    public static final int NUM_FIVE = 5;
    public static final int NUM_TEN = 10;
    public static final int DEFAULT_TICK_NUM = 4;
    public static double DEFAULT_VERTICAL_STEP = 0.2;

    /**
     * 对象路径使用
     */
    public static final String SLASH = "/";
    public static final String BLACK = "";

    /**
     * Bucket名称限制，正则表达式规则、长度限制
     * 规则1:只能是数字、消息字母、连字符-、点号.;只能以数字或字母开头或结尾
     * 规则2:Bucket名称不能格式化为IP地址(例如，xxx.xxx.xxx.xxx)
     * 规则3：Bucket名称的长度必须在3到63个字符之间
     */
    public static final String BUCKET_NAME_RULE1 = "[a-z0-9][a-z0-9.-]*[a-z0-9]";
    public static final String BUCKET_NAME_RULE2 = "([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\." +
            "(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}";
    public static final int BUCKET_NAME_MAX_LENGTH = 63;
    public static final int BUCKET_NAME_MIN_LENGTH = 3;

    /**
     * 对象名称大小限制
     */
    public static final int OBJECT_NAME_MAX_LENGTH = 255;

    /**
     * 对象分享时失效时间，默认7 * 24 * 60 * 60（7天，单位是秒）
     */
    public static final int OBJECT_DEFAULT_EXPIRIED_TIME = 7 * 24 * 60 * 60;
    public static final int OBJECT_MIN_EXPIRED_TIME = 60;

    /**
     * 系统用户名使用
     */
    public static final String CREATE_BY = "createdBy";

    /**
     * 下载对象时buffer大小，默认4KB
     */
    public static final int BUFFER_SIZE = 1024 * 4;

    /**
     * 临时测试使用
     */
    public static final String DEFALUT_USER_ID = "1";
}
